package top.houry.linklist;

/**
 * @Desc
 * @Author houruiyang
 * @Date 2022/9/16
 **/
public class FindMin {

    public int findMin(int[] nums) {
        if (null == nums || nums.length <= 0) {
            return -1;
        }

        int start = 0;
        int end = nums.length - 1;
        int target = nums[end];
        while (start + 1 < end) {
            int mid = start + (end - start) / 2;
            if (nums[mid] <= target) {
                end = mid;
            } else {
                start = mid;

            }
        }

        return Math.min(nums[start], nums[end]);

    }

    public static void main(String[] args) {

    }
}
